/**
 * Created by luoluo on 16/3/23.
 */
$(function(){
    $(".tr_address").hover(
        function(){
            $(this).css("background","#f2f2f2");
            $(this).children().last().not($(".default_address")[0]).html("<button >设为默认</button>");
        },
        function(){
            $(this).css("background","none");
            $(this).children().last().not($(".default_address")[0]).html("")
        });
    /*效果图悬停的效果*/
    $(".effect_pic_box").hover(

        function(){

            $(this).children("p").css("display","block");
        },
        function(){
            $(this).children("p").css("display","none");
        }
    )
    /*打开个人中心板块*/
    $(".person_center").click(function(){

        var openboard=$(".center_right_dis_block");
        $(openboard).removeClass("center_right_dis_block");
        $(openboard).addClass("center_right_dis_none");
        $("#userhome").removeClass("center_right_dis_none");
        $("#userhome").addClass("center_right_dis_block");

    });
    /*订单板块*/
    $(".order_board").click(function(){

        var openboard=$(".center_right_dis_block");
        $(openboard).removeClass("center_right_dis_block");
        $(openboard).addClass("center_right_dis_none");
        $("#odermanager").removeClass("center_right_dis_none");
        $("#odermanager").addClass("center_right_dis_block");

    });
    /*个人信息*/
    $(".usermsg_board").click(function(){

        var openboard=$(".center_right_dis_block");
        $(openboard).removeClass("center_right_dis_block");
        $(openboard).addClass("center_right_dis_none");
        $("#alterusermag").removeClass("center_right_dis_none");
        $("#alterusermag").addClass("center_right_dis_block");

    });
    /*地址信息*/
    $(".address_board").click(function(){

        var openboard=$(".center_right_dis_block");
        $(openboard).removeClass("center_right_dis_block");
        $(openboard).addClass("center_right_dis_none");
        $("#userAddress").removeClass("center_right_dis_none");
        $("#userAddress").addClass("center_right_dis_block");

    });
    /*修改密码*/
    $(".alterpwd_board").click(function(){
        var openboard=$(".center_right_dis_block");
        $(openboard).removeClass("center_right_dis_block");
        $(openboard).addClass("center_right_dis_none");
        $("#alterpwd").removeClass("center_right_dis_none");
        $("#alterpwd").addClass("center_right_dis_block");

    });
    /*效果图*/
    $(".effect_pic_board").click(function(){
        var openboard=$(".center_right_dis_block");
        $(openboard).removeClass("center_right_dis_block");
        $(openboard).addClass("center_right_dis_none");
        $("#effect_pic").removeClass("center_right_dis_none");
        $("#effect_pic").addClass("center_right_dis_block");

    });
});

function navList(id) {
    var $obj = $("#juheweb"), $item = $("#J_nav_" + id);
    $item.addClass("on").parent().removeClass("none").parent().addClass("selected");
    $obj.find("h4").hover(function () {
        $(this).addClass("hover");
    }, function () {
        $(this).removeClass("hover");
    });
    $obj.find("p").hover(function () {
        if ($(this).hasClass("on")) { return; }
        $(this).addClass("hover");
    }, function () {
        if ($(this).hasClass("on")) { return; }
        $(this).removeClass("hover");
    });
    $obj.find("h4").click(function () {
        var $div = $(this).siblings(".list-item");
        if ($(this).parent().hasClass("selected")) {
            $div.slideUp(600);
            $(this).parent().removeClass("selected");
        }
        if ($div.is(":hidden")) {
            $("#juheweb li").find(".list-item").slideUp(600);
            $("#juheweb li").removeClass("selected");
            $(this).parent().addClass("selected");
            $div.slideDown(600);

        } else {
            $div.slideUp(600);
        }
    });
}